<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns:shiro="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>

<style>
	.columns{
		margin-left:10px;
	}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="col-sm-12">
		<div class="columns pull-left col-md-1 nopadding">


			<input class="hidden" id="year" name="year" th:value="${year}" >
			<select id="refundRrNot" name="refundRrNot" class="form-control" >
				<option value="">请选择返费状态</option>
				<option value="0">未返费</option>
				<option value="1">已返费</option>
				<option value="2">返费未成功</option>
			</select>
		</div>
		<div class="columns pull-left col-md-1 nopadding">
			<input id="searchName" type="text" class="form-control"
				   placeholder="学校名称">
		</div>
		<div class="columns pull-left col-md-1 nopadding">
			<input id="searchProvince" name="province" type="text" class="form-control"
				   placeholder="省份">
		</div>
		<!--			<div class="columns pull-left col-md-1 nopadding">-->
		<!--				<select id="searchYear" name="searchYear" class="form-control" >-->
		<!--					<option value="">请选择年份</option>-->
		<!--					<option value="2020">2020</option>-->
		<!--					<option value="2021">2021</option>-->
		<!--					<option value="2022">2022</option>-->
		<!--					<option value="2023">2023</option>-->
		<!--					<option value="2024">2024</option>-->
		<!--					<option value="2025">2025</option>-->
		<!--				</select>-->
		<!--			</div>-->
		<div class="columns pull-left col-md-1 nopadding">
			<input id="regionUserName" type="text" class="form-control"
				   placeholder="考评负责人">
		</div>
		<div class="columns pull-left col-md-1 nopadding">
			<input id="expertName" type="text" class="form-control"
				   placeholder="姓名(开户人)">
		</div>
		<label class="layui-form-label" style="width:100px">考评时间:</label>
		<div class="columns pull-left nopadding">
			<div class="layui-inline" id="examinationDate">
				<div class="layui-input-inline" style="float:left">
					<input type="text" autocomplete="off" id="examStartDate" class="layui-input" placeholder="开始日期">
				</div>
				<div class="layui-form-mid">-</div>
				<div class="layui-input-inline" style="float:left">
					<input type="text" autocomplete="off" id="examEndDate" class="layui-input" placeholder="结束日期">
				</div>
			</div>
		</div>
		<div class="columns pull-left col-md-1 nopadding">
			<input id="batchId" type="text" class="form-control"
				   placeholder="批次号" name="batchId">
		</div>
		<div class="layui-form-mid">-</div>
		<div class="columns pull-left col-md-1 nopadding">
			<input id="batchId2" type="text" class="form-control"
				   placeholder="批次号" name="batchId2">
		</div>
		<div class="columns pull-left">
			<button class="btn btn-success" onclick="reLoad()">查询</button>
			<button shiro:hasPermission="jzweb:refund:import" type="button" class="btn  btn-primary" onclick="downExcel()">
				<i class="fa fa-download" aria-hidden="true"></i>导出
			</button>
			<button  type="button" class="btn  btn-success"
					 onclick="refndExcel()" shiro:hasPermission="jzweb:refund:import">
				<i class="fa fa-download" aria-hidden="true"></i>选择导出
			</button>
			<button  type="button" class="btn btn-danger" onclick="analysis()">
				<i class="fa fa-bar-chart" aria-hidden="true"></i>统计分析
			</button>
			<button  shiro:hasPermission="jzweb:refund:refunds" type="button" class="btn btn-info" onclick="refunds()">
				<i class="fa fa-save" aria-hidden="true"></i>批量返费
			</button>
			<button  shiro:hasPermission="jzweb:refund:returnBatchCost" type="button" class="btn btn-info" onclick="returnBatchCost()">
				<i class="fa fa-save" aria-hidden="true"></i>批量退回
			</button>
			<button  shiro:hasPermission="jzweb:refund:batchConfirm2" type="button" class="btn btn-info" onclick="batchConfirm2()">
				<i class="fa fa-save" aria-hidden="true"></i>批量确认
			</button>
		</div>
	</div>
	<div class="col-sm-12">

		<div class="ibox">
			<div class="ibox-body">
				<div class="fixed-table-toolbar">
					<div class="columns pull-left">
						<button shiro:hasPermission="jzweb:examinationCost:add" type="button" class="btn  btn-primary" onclick="add()">
							<i class="fa fa-plus" aria-hidden="true"></i>新增
						</button>
						<button shiro:hasPermission="jzweb:refund:import" type="button"
								class="btn  btn-success"
								onclick="downExcelModel('/jzweb/refund/downloadImportTemplate')">
							<i class="fa fa-download" aria-hidden="true"></i>下载导入模板
						</button>
						<button shiro:hasPermission="jzweb:refund:batchRemove" type="button" class="btn  btn-danger"
								onclick="batchRemove()">
							<i class="fa fa-trash" aria-hidden="true"></i>删除
						</button>
					</div>
					<!--					<div class="columns pull-left" style="margin-left:4px">-->
					<!--						<select id="refundType" name="refundType" class="form-control" >-->
					<!--							<option value="">请选择返费类型</option>-->
					<!--							<option value="0">对公</option>-->
					<!--							<option value="1">对私</option>-->
					<!--						</select>-->
					<!--					</div>-->
					<div class="columns pull-left" style="margin-left:4px">
						<input id="school" name="school" type="text" class="form-control" placeholder="输入返费学校名称查询">
					</div>

					<div class="columns pull-left" style="margin-left:4px">
						<form shiro:hasPermission="jzweb:refund:import" id="importExcelForm" method="post"
							  enctype="multipart/form-data">
							<input class="form-control" style="width:200px" name="file" id="fileUrl" type="file">
						</form>
					</div>

					<div class="columns pull-left" style="margin-left:4px">

						<button shiro:hasPermission="jzweb:refund:import" type="button"
								class="btn  btn-success"
								onclick="importExcel($('#fileUrl'),$('#importExcelForm'),'/jzweb/refund/import')">
							<i class="fa fa-upload" aria-hidden="true"></i>导入
						</button>

					</div>

				</div>
			</div>
		</div>


	</div>
	<table id="exampleTable" data-mobile-responsive="true">
		<div class="columns pull-left" style="margin-left:10px;margin-top:10px;">
			统计：
			<button id="laborCostTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(1)">
			</button>
			<button id="mealsTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(2)">
			</button>
			<button id="trafficExpenseTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(3)">
			</button>
			<button id="hotelExpenseTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(4)">
			</button>
			<button id="postageTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(5)">
			</button>
			<button id="trafficExpenseMaxTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(6)">
			</button>
			<button id="otherCostTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(7)">
			</button>
			<button id="sumExpenseTotal" type="button"
					class="btn btn-danger" style="border-radius:10px;" onclick="reLoad(8)">
			</button>

		</div>
	</table>
</div>
<!--shiro控制bootstraptable行内按钮看见性 -->
<div>
	<script type="text/javascript">
		var s_edit_h = 'hidden';
		var s_remove_h = 'hidden';
		var s_resetPwd_h = 'hidden';
		var s_return_h = 'hidden';
		var s_batchConfirm_h = 'hidden';
	</script>
</div>
<div shiro:hasPermission="jzweb:refund:batchConfirm">
	<script type="text/javascript">
		s_batchConfirm_h = '';
	</script>
</div>
<div shiro:hasPermission="jzweb:refund:returnCost">
	<script type="text/javascript">
		s_return_h = '';
	</script>
</div>
<div shiro:hasPermission="jzweb:refund:edit">
	<script type="text/javascript">
		s_edit_h = '';
	</script>
</div>
<div shiro:hasPermission="jzweb:refund:remove">
	<script type="text/javascript">
		var s_remove_h = '';
	</script>
</div>
<div shiro:hasPermission="jzweb:refund:resetPwd">
	<script type="text/javascript">
		var s_resetPwd_h = '';
	</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/webJs/jzweb/refund/refund.js"></script>

<script>
	layui.use('laydate', function(){
		var laydate = layui.laydate;

		laydate.render({
			elem: '#examinationDate'
			//设置开始日期、日期日期的 input 选择器
			//数组格式为 2.6.6 开始新增，之前版本直接配置 true 或任意分割字符即可
			,range: ['#examStartDate', '#examEndDate']
		});
	})
	function analysis() {
		alert("暂未开放！");
	}
	function refndExcel() {

		layer.confirm('您确定要导出考试费返费详情信息吗？', {
			btn1:function(index){
				var rows = $('#exampleTable').bootstrapTable('getSelections');
				var ids = new Array();
				var flag=true
				if (rows.length == 0) {
					layer.msg("请选择数据！");
					return;
				}
				// 遍历所有选择的行数据，取每条数据对应的ID
				$.each(rows, function(i, row) {
					ids[i] = row['id'];
				});

				$.ajax({
					type : 'POST',
					data : {
						"ids" : ids
					},
					url :  '/jzweb/refund/refndExcelRole?ids[]='+ids,
					success : function(r) {
						if (r.code == 0) {
							layer.msg(r.msg);
							var url1='/jzweb/refund/refndExcel?ids[]='+ids;
							window.location.href = url1;
							layer.close(index)
							reLoad();
						} else {
							layer.msg(r.msg);
						}
					}
				});



			}
		});
	}
	function downExcel() {
		layer.confirm('您确定要导出返费选择的信息吗？', {
			btn1:function(index){
				var url='/jzweb/refund/exportFileRole?schoolName='+$('#searchName').val()+'&&refundRrNot='+$('#refundRrNot').val()+'&&province='+$('#searchProvince').val() +
						'&&year='+$('#year').val()+'&&regionUserName='+$('#regionUserName').val()+'&&examStartDate='+$('#examStartDate').val()+'&&examEndDate='+$('#examEndDate').val()+'&&batchId='+$('#batchId').val()+'&&batchId2='+$('#batchId2').val()+'&&expertName='+$('#expertName').val();
				$.ajax({
					type : 'POST',
					url :  url,
					success : function(r) {
						if (r.code == 0) {
							layer.msg(r.msg);
							var url='/jzweb/refund/exportFile?schoolName='+$('#searchName').val()+'&&refundRrNot='+$('#refundRrNot').val()+'&&province='+$('#searchProvince').val() +
									'&&year='+$('#year').val()+'&&regionUserName='+$('#regionUserName').val()+'&&examStartDate='+$('#examStartDate').val()+'&&examEndDate='+$('#examEndDate').val()+'&&batchId='+$('#batchId').val()+'&&batchId2='+$('#batchId2').val()+'&&expertName='+$('#expertName').val();
							window.location.href = url;
							layer.close(index)
							reLoad();
						} else {
							layer.msg(r.msg);
						}
					}
				});
				//
				// window.location.href = url;
				// layer.close(index)
			}
		});
	}


	// function downExcel() {
	// 	layer.confirm('您确定要导出返费选择的信息吗？', {
	// 		btn1:function(index){
	// 			var url='/jzweb/refund/exportFile?schoolName='+$('#searchName').val()+'&&refundRrNot='+$('#refundRrNot').val()+'&&province='+$('#searchProvince').val() +
	// 					'&&year='+$('#year').val()+'&&regionUserName='+$('#regionUserName').val()+'&&examStartDate='+$('#examStartDate').val()+'&&examEndDate='+$('#examEndDate').val()+'&&batchId='+$('#batchId').val()+'&&batchId2='+$('#batchId2').val()+'&&expertName='+$('#expertName').val();
	// 			window.location.href = url;
	// 			layer.close(index)
	// 		}
	// 	});
	// }

</script>
</body>
</html>